package _021_10_3

func strStr(haystack string, needle string) int {
	n, m := len(haystack), len(needle)
	find := true
	if len(needle) == 0 {
		return 0
	}
	for i := 0; i+m <= n; i++ {
		for j := 0; j < m; j++ {
			find = true
			if haystack[i+j] != needle[j] {
				find = false
				break
			}
		}
		if find {
			return i
		}
	}
	return -1
}
